import { createApp } from 'vue'
import './style.css'
import App from './App.vue'

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import router from './router'

import { createPinia } from 'pinia'

// 如果您正在使用CDN引入，请删除下面一行。
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import {useUserStore} from '@/store/user'

const app = createApp(App)
const pinia = createPinia()

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
// console.log('main.ts'+ Math.random());
app.use(pinia)

const userStore = useUserStore()
const { refreshUserInfo } = userStore
await refreshUserInfo()

app.use(router).use(ElementPlus, {
  locale: zhCn,
}).mount('#app')
